<%include ../inc/header.html%>
<%include ../inc/aside.html%>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            首页
            <small>新闻管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li class="active">新闻管理</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">新闻列表</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <form method="POST">
                            <input type="hidden" name="id" value="<%=news.id%>"/>
                            <div class="form-group">
                                <label>标题</label>
                                <input type="text" name="title" value="<%=news.title%>" class="form-control"/>
                            </div>

                            <div class="form-group">
                                <label>所属栏目</label>
                                <select name="columnId">
                                    <%columns.forEach(function(column) {%>
                                        <%if(column.id == news.columnId){%>
                                        <option value="<%=column.id%>" selected="selected"><%=column.name%></option>
                                        <%} else {%>
                                        <option value="<%=column.id%>"><%=column.name%></option>
                                        <%}%>
                                    <%})%>
                                </select>
                            </div>

                            <div class="form-group">
                                <label>作者</label>
                                <input type="text" name="author" value="<%=news.author%>" class="form-control"/>
                            </div>

                            <div class="form-group">
                                <label>内容</label>
                                <textarea id="content" name="content" cols="50" rows="8" class="form-control"><%=news.content%></textarea>
                            </div>

                            <div class="form-group">
                                <label>置顶</label> &nbsp;&nbsp;
                                <%if(news.isTop){%>
                                <input type="checkbox" checked="checked" name="isTop" value="true"/>
                                <%}else{%>
                                <input type="checkbox" name="isTop" value="true"/>
                                <%}%>
                            </div>

                            <div class="form-group">
                                <label>推荐</label> &nbsp;&nbsp;
                                <%if(news.isRecommend){%>
                                    <input type="checkbox" checked="checked" name="isRecommend" value="true"/>
                                <%}else{%>
                                    <input type="checkbox" name="isRecommend" value="true"/>
                                <%}%>
                            </div>

                            <div class="form-group">
                                <input type="submit" onclick="return doSubmit();" class="btn btn-primary" value="提交"/>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>

<script>
    $(document).ready(function() {
        UM.getEditor("content");
    })
</script>
<%include ../inc/footer.html%>